package com.api.gbhg.zengping.dao;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import sun.rmi.runtime.Log;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetTrans;

import java.math.BigDecimal;
import java.util.Map;

/**
 * @program: gbhg-oa
 * @author: Mr.zeng
 * @create: 2020-12-25 11:29
 *
 **/
public class PropertyManagementCostDao implements Dao{
    public static final Logger LOGGER = LoggerFactory.getLogger("gbhg");

    /**
     * 物业费核批列表查询
     * @param lcStatus  流程状态  3已审批   非3未审批
     * @param pageNum 当前页
     * @param pageSize  页大小
     * @return
     */
    @Override
    public  RecordSetTrans getSBInfo(String lcStatus,Integer pageNum,Integer pageSize,String requestId){
        RecordSetTrans rts=new RecordSetTrans();
        StringBuffer sb=new StringBuffer();
        /*String sql="SELECT wy.id AS orderid,lcjlsqjlid,xmmin,sum(yszje)yszje,sbdw,sbks,jbr,sum(mjpf)mjpf,sum(glfwyn)glfwyn,sum(ndjfxqwy)ndjfxqwy,mainid FROM uf_jingfei_version v,uf_wygljfbb wy,uf_wygljfbb_dt1 \n" +
                "WHERE v.lcjlsqjlid=wy.requestId AND mainid=wy.id";*/
        String sql="SELECT t.id AS orderid,lcjlsqjlid,xmmin,sum(yszje)yszje,sbdw,sbks,jbr,sum(mjpf)mjpf,sum(glfwyn)glfwyn,sum(ndjfxqwy)ndjfxqwy,mainid FROM uf_jingfei_version v,uf_wygljfbb t,uf_wygljfbb_dt1 \n" +
                "WHERE v.lcjlsqjlid=t.requestId AND mainid=t.id ";
        sb.append(sql);
        try {
            if("3".equals(lcStatus)){
                sb.append(" AND lcztz="+lcStatus+" AND t.requestId IN("+requestId+")");
            }else {
                sb.append(" AND lcztz<> 3 AND t.requestId IN("+requestId+")");
            }
            sb.append(" group by t.id,lcjlsqjlid,xmmin,sbdw,sbks,jbr,mainid ");
            //通过分页公式计算下一页在哪一行开始
            //如1，10，1-1 = 0，那第一条开始显示下面十条，第一页
            //如2，10，(2-1)乘以10 = 10，那就是第十条开始显示下面十条，第二页
            // 判断是mysql 还是sqlserver
            pageNum=(pageNum-1)*pageSize;
            if("sqlserver".equals(rts.getDBType())){
               sb.append(" order by t.Id offset "+pageNum+" rows fetch next "+pageSize+" rows only");
            }else if("mysql".equals(rts.getDBType())){
                sb.append(" LIMIT "+pageNum+","+pageSize+"");
            }
            LOGGER.info("===========物业费核批列表数据查询==================="+sb.toString());
            rts.executeQuery(sb.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return rts;
    }

    public  RecordSetTrans getSBInfo(String requestId){
        RecordSetTrans rts=new RecordSetTrans();
        StringBuffer sb=new StringBuffer();
        String sql="SELECT t.id AS orderid,lcjlsqjlid,xmmin,sum(yszje)yszje,sbdw,sbks,jbr,sum(mjpf)mjpf,sum(glfwyn)glfwyn,sum(ndjfxqwy)ndjfxqwy,mainid,sum(djypfm)djypfm FROM uf_jingfei_version v,uf_wygljfbb t,uf_wygljfbb_dt1 \n" +
                "WHERE v.lcjlsqjlid=t.requestId AND mainid=t.id ";
        sb.append(sql);
        try {
                sb.append("  AND t.requestId IN("+requestId+")");
            sb.append(" group by t.id,lcjlsqjlid,xmmin,sbdw,sbks,jbr,mainid ");
            //通过分页公式计算下一页在哪一行开始
            //如1，10，1-1 = 0，那第一条开始显示下面十条，第一页
            //如2，10，(2-1)乘以10 = 10，那就是第十条开始显示下面十条，第二页
            // 判断是mysql 还是sqlserver
            LOGGER.info("物业费核批列表数据查询---------------------->"+sb.toString());
            rts.executeQuery(sb.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return rts;
    }

    /**
     * 分页方法
     * @param rts
     * @param sb
     * @param lcStatus
     * @param pageNum
     * @param pageSize
     * @return
     */
    public static StringBuffer limitSize(RecordSetTrans rts,StringBuffer sb,String lcStatus,int pageNum,int pageSize,String group,String requestId){
        if("3".equals(lcStatus)){
            sb.append(" AND lcztz="+lcStatus+" AND t.requestId IN("+requestId+")");
        }else {
            sb.append(" AND lcztz<> 3  AND t.requestId IN("+requestId+")");
        }
        //通过分页公式计算下一页在哪一行开始
        //如1，10，1-1 = 0，那第一条开始显示下面十条，第一页
        //如2，10，(2-1)乘以10 = 10，那就是第十条开始显示下面十条，第二页
       // 添加group by 语句
        sb.append(group);
        pageNum=(pageNum-1)*pageSize;
        // 判断是mysql 还是sqlserver
        if("sqlserver".equals(rts.getDBType())){
            sb.append(" order by t.Id offset "+pageNum+" rows fetch next "+pageSize+" rows only");
        }else if("mysql".equals(rts.getDBType())){
            sb.append(" LIMIT "+pageNum+","+pageSize+"");
        }
        return sb;
    }
    public static StringBuffer limitSize(StringBuffer sb,String group,String requestId){
            sb.append("  AND t.requestId IN("+requestId+")");
        //通过分页公式计算下一页在哪一行开始
        //如1，10，1-1 = 0，那第一条开始显示下面十条，第一页
        //如2，10，(2-1)乘以10 = 10，那就是第十条开始显示下面十条，第二页
        // 添加group by 语句
        sb.append(group);
        return sb;
    }

    /**
     * 物业费核批列表查询条数   uf_wygljfbb
     * @param lcztz
     * @return
     */
    @Override
    public RecordSetTrans getSBInfoCount(String lcztz,String tableName,String requestId){
        RecordSetTrans rts=new RecordSetTrans();
        StringBuffer sb=new StringBuffer();
        String sql="SELECT count(orderid)num FROM (SELECT t.id AS orderid,lcjlsqjlid,xmmin," +
                "sum(yszje)yszje,sbdw,sbks,jbr,sum(mjpf)mjpf,sum(glfwyn)glfwyn,sum(ndjfxqwy)ndjfxqwy,mainid " +
                "FROM uf_jingfei_version v,"+tableName+" t,"+tableName+"_dt1\n" +
                "WHERE v.lcjlsqjlid=t.requestId AND mainid=t.id ";

        sb.append(sql);
        try {
            if("3".equals(lcztz)){
                sb.append(" AND lcztz="+lcztz+" and t.requestId IN("+requestId+")");
            }else {
                sb.append(" AND lcztz<> 3 and t.requestId IN("+requestId+")");
            }
            sb.append(" group by t.id,lcjlsqjlid,xmmin,sbdw,sbks,jbr,mainid) t");
            LOGGER.info("===========物业费核批列表查询条数==================="+sb.toString());
            rts.executeQuery(sb.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return rts;
    }
    public RecordSetTrans getSBInfoCount(String tableName,String requestId){
        RecordSetTrans rts=new RecordSetTrans();
        StringBuffer sb=new StringBuffer();
        String sql="SELECT count(orderid)num FROM (SELECT t.id AS orderid,lcjlsqjlid,xmmin," +
                "sum(yszje)yszje,sbdw,sbks,jbr,sum(mjpf)mjpf,sum(glfwyn)glfwyn,sum(ndjfxqwy)ndjfxqwy,mainid " +
                "FROM uf_jingfei_version v,"+tableName+" t,"+tableName+"_dt1\n" +
                "WHERE v.lcjlsqjlid=t.requestId AND mainid=t.id ";

        sb.append(sql);
        try {
                sb.append("  and t.requestId IN("+requestId+")");
            sb.append(" group by t.id,lcjlsqjlid,xmmin,sbdw,sbks,jbr,mainid) t");
            LOGGER.info("物业费核批列表查询条数:------------------>"+sb.toString());
            rts.executeQuery(sb.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return rts;
    }

    /**
     * 物业列表批量审批 (归档)
     * @param lcjlsqjj  流程记录申请记录
     * @return
     */
    public void updateBatchApprovalArchive(Integer[] lcjlsqjj){
        RecordSet rs=new RecordSet();
        for (Integer lcid:lcjlsqjj
             ) {
            String sql="UPDATE uf_jingfei_version SET lcztz='3' WHERE `lcjlsqjlid`=?";
            LOGGER.info("====物业列表批量审批(归档)====="+sql+lcid);
            rs.executeUpdate(sql,lcid);
        }
    }
    /**
     * 物业列表批量审批  (退回)
     * @param lcjlsqjj  流程记录申请记录
     * @return
     */
    public void updateBatchApprovalFallBack(Integer[] lcjlsqjj){
        RecordSet rs=new RecordSet();
        for (Integer lcid:lcjlsqjj
        ) {
            String sql="UPDATE uf_jingfei_version SET lcztz='1' WHERE `lcjlsqjlid`=?";
            LOGGER.info("====物业列表批量审批(退回)====="+sql+lcid);
            rs.executeUpdate(sql,lcid);
        }
    }


    /**
     * 查询申报单位   SELECT `SUBCOMPANYNAME` FROM hrmsubcompany;
     * @param id
     * @return
     */
    public RecordSet getSBDWById(Integer id){
        RecordSet rts=new RecordSet();
        String sql="select SUBCOMPANYNAME from hrmsubcompany where id="+id;
        try {
            LOGGER.info("查询申报单位查询sql------>"+sql);
            rts.executeQuery(sql);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return rts;
    }

    /**
     * 查询申报科室   SELECT `SUBCOMPANYNAME` FROM hrmsubcompany;
     * @param id
     * @return
     */
    public RecordSet getSBKSById(Integer id){
        RecordSet rts=new RecordSet();
        String sql="select departmentmark from HrmDepartment where id="+id;
        try {
            LOGGER.info("申报科室查询sql---------->"+sql);
            rts.executeQuery(sql);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return rts;
    }

    /**
     * 查询用户名
     * @param id
     * @return
     */
    public RecordSet getUserNameById(Integer id){
        RecordSet rts=new RecordSet();
        String sql="select lastname from hrmResource where id="+id;
        try {
            LOGGER.info("用户查询sql-------->"+sql);
            rts.executeQuery(sql);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return rts;
    }
    /**
     * 查询用户名 查询多人力
     * @param ids
     * @return
     */
    public String getUserNameByIds(String ids){
        RecordSet rts=new RecordSet();
        String sql="select lastname from hrmResource where id in("+ids+")";
        try {
            LOGGER.info("用户查询sql-------->"+sql);
            rts.executeQuery(sql);
        } catch (Exception e) {
            e.printStackTrace();
        }
        StringBuffer sb=new StringBuffer();
        while (rts.next()){
            sb.append(rts.getString("lastname")+",");
        }
        return sb.substring(0,sb.lastIndexOf(","));
    }

    /**
     * // 经费额度信息查询（数据同步)
     * @param lcjlId
     * @return
     */
    public RecordSet getBudgeLinesById(String lcjlId){
        RecordSet rs=new RecordSet();
                /*String sql="select lcjlsqjlid,lcbj,lcid,ysnd,SUM(yszje)yszje,bmyszcjjfl,dyzfjjfl,sbdw,xmmin from uf_jingfei_version,uf_wygljfbb w,uf_wygljfbb_dt1,uf_wygljfbb_dt2 where lcjlsqjlid=w.requestId  and sfky=1 and lcjlsqjlid="+lcjlId+"\n" +
                        "group by bmyszcjjfl,dyzfjjfl,lcbj,lcid,ysnd,lcjlsqjlid,sbdw,xmmin";*/
        String sql="select lcjlsqjlid,lcbj,lcid,ysnd,hjwy,bmyszcjjfl,dyzfjjfl,sbdw,xmmin,jbr,gkdw,sydw  from uf_jingfei_version,uf_wygljfbb w,uf_wygljfbb_dt2 t2 where lcjlsqjlid=w.requestId  and sfky=1 and lcjlsqjlid="+lcjlId+"  and w.id=t2.mainid";
                /*" group by bmyszcjjfl,dyzfjjfl,lcbj,lcid,ysnd,lcjlsqjlid,sbdw,xmmin,jbr"*/
        LOGGER.info("======================="+sql);
        rs.executeQuery(sql);
        return rs;
    }

    /**
     * 经费信息查询
     * @param lcjlId
     * @return
     */
    public RecordSet queryJingfeiBylcjlId(String lcjlId){
        RecordSet rs= new RecordSet();
//        String sql="SELECT id,lcbj,lcjlid,xmmc,modedatamodifier,modedatamodifydatetime FROM uf_jingfei WHERE lcjlid="+lcjlId+"";
        String sql="SELECT j.id,lcid,lcjlid,xmmc,j.modedatamodifier,j.modedatamodifydatetime FROM uf_jingfei j,uf_jingfei_version v WHERE v.lcjlsqjlid=j.lcjlid and lcjlid="+lcjlId+"";
        LOGGER.info("================================="+sql);
        rs.executeQuery(sql);
        return rs;
    }
    /**
     * // 经费额度信息插入
     * @param param
     * @return 
     */
    public boolean insertBudgeLines(Map<String,String> param){
        RecordSetTrans rts=new RecordSetTrans();
        String sql="insert into uf_jingfei(requestId,lcbj,lcjlid,bmzcjjfl,zfjjfl,nd,ze,syed,dj,sbdw,xmmc,modedatamodifier,modedatamodifydatetime,gkdw,sydw)values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
        try {
            rts.executeUpdate(sql,
                    param.getOrDefault("requestId",""),
                    param.getOrDefault("lcbj",""),
                    param.getOrDefault("lcjlid",""),
                    param.getOrDefault("bmzcjjfl",""),
                    param.getOrDefault("zfjjfl",""),
                    param.getOrDefault("nd",""),
                    param.getOrDefault("ze",""),
                    param.getOrDefault("syed",""),
                    param.getOrDefault("dj",""),
                    param.getOrDefault("sbdw",""),
                    param.getOrDefault("xmmc",""),
                    param.getOrDefault("modedatamodifier",""),
                    param.getOrDefault("modedatamodifydatetime",""),
                    param.getOrDefault("gkdw",""),
                    param.getOrDefault("sydw","")
            );
            LOGGER.info("经费额度信息插入"+sql);
        } catch (Exception e) {
            e.printStackTrace();
            rts.rollback();
            return false;
        }
        rts.commit();
        return true;
    }

    /**
     * 查看经费是否重复
     * @param lcjlid
     * @param bmzcjjfl
     * @param nd
     * @return
     */
    public RecordSet queryCountJingfei(String lcjlid,String bmzcjjfl,String nd){
        RecordSet rs=new RecordSet();
        String countSql="select count(1)AS num from uf_jingfei where lcjlid="+lcjlid+" and bmzcjjfl="+bmzcjjfl+" and nd="+nd+"";
        rs.executeQuery(countSql);
        return rs;
    }

    /**
     *
     * @param param  lcjlid、bmzcjjfl、money
     * @param   （经费表）记录是哪条记录未成功
     * @return
     * @throws Exception
     */
    public boolean queryJingfei(Map<String, String>[] param,Map<String, String> map) throws Exception {
        RecordSet rs = new RecordSet();
        RecordSetTrans rst = new RecordSetTrans();
        //取消自动提交
        rst.setAutoCommit(false);
        for (int i = 0; i < param.length; i++) {
            //流程记录id
            String lcjlid = param[i].get("lcjlid");
            //部门支出经济分类
            String bmzcjjfl = param[i].get("bmzcjjfl");
            //报销金额
            BigDecimal money = new BigDecimal(param[i].get("money"));
            BigDecimal cxje = new BigDecimal(param[i].get("cxje"));
            LOGGER.info("BigDecimal money:" + money + ",cxje:" + cxje);
            money = money.subtract(cxje);
            String querySql = "SELECT syed,dj FROM uf_jingfei  WHERE lcjlid=" + lcjlid + " AND bmzcjjfl=" + bmzcjjfl + " ";
            rs.executeQuery(querySql);
            boolean b = true;
            while (rs.next()) {
                BigDecimal syed = new BigDecimal(rs.getDouble("syed"));
                BigDecimal dj = new BigDecimal(rs.getDouble("dj"));
                syed = syed.subtract(money);
                dj = dj.add(money);
                String updateSql = "update uf_jingfei set syed=" + syed + ",dj=" + dj + " where lcjlid=" + lcjlid + " and bmzcjjfl=" + bmzcjjfl + "";
                LOGGER.info("经费表冻结金额：-------------------->" + updateSql);
                b = rst.executeUpdate(updateSql);
            }
            if (!b) {
                rst.rollback();
                return false;
            }
        }
        rst.commit();
        return true;
    }

    /**
     *
     * @param param  lcjlid、bmzcjjfl、money
     * @param  （经费表）记录是哪条记录未成功
     *    TODO 主表
     * @return
     * @throws Exception
     */
    public boolean queryJingfei(Map<String, String> param, Boolean flag) {
        RecordSet rs = new RecordSet();
        boolean b = true;
        //流程记录id
        String lcjlid = param.get("lcjlid");
        //部门支出经济分类
        String bmzcjjfl = param.get("bmzcjjfl");
        String cxje1 = param.get("cxje");
        //报销金额
        BigDecimal money = new BigDecimal(param.get("money"));
        BigDecimal cxje = new BigDecimal(cxje1);
        money = money.subtract(cxje);
        LOGGER.info("BigDecimal money:" + money+"cxje:"+cxje);
        // 查询语句
        String querySql = "SELECT syed,dj FROM uf_jingfei  WHERE lcjlid=" + lcjlid + " AND bmzcjjfl=" + bmzcjjfl + " ";
        rs.executeQuery(querySql);
        if (rs.next()) {
            BigDecimal syed = new BigDecimal(rs.getDouble("syed"));
            BigDecimal dj = new BigDecimal(rs.getDouble("dj"));
            if (flag) {
                syed = syed.add(money);
                dj = dj.subtract(money);
            } else {
                syed = syed.subtract(money);
                dj = dj.add(money);
            }
            String updateSql = "update uf_jingfei set syed=" + syed + ",dj=" + dj + " where lcjlid=" + lcjlid + " and bmzcjjfl=" + bmzcjjfl + "";
            LOGGER.info("经费表冻结金额：-------------------->" + updateSql);
            b = rs.executeUpdate(updateSql);
        }
        return b;
    }

    /**
     * 添加经费明细表数据
     * @param param
     */
    public void addJingfeiDetail(Map<String,Object> param){
        //报销金额、审批状态、报销人、报销人部门、经办部门、经办人员、申请日期、报销流程名称、报销流程记录id、流程编号
        String sql="insert into uf_jingfei_dt1(mainid,bxje,spzt,bxr,bxrbm,jbbm,jbry,sqrq,bxlcmc,bxlcjlid,lcbh,bz)" +
                "values(?,?,?,?,?,?,?,?,?,?,?,?)";
        LOGGER.info("============添加经费明细表数据====================="+sql);
        RecordSetTrans rst=new RecordSetTrans();
        try {
            rst.executeUpdate(sql,
                    param.getOrDefault("mainid",""),
                    param.getOrDefault("bxje",""),
                    param.getOrDefault("spzt",""),
                    param.getOrDefault("bxr",""),
                    param.getOrDefault("bxrbm",""),
                    param.getOrDefault("jbbm",""),
                    param.getOrDefault("jbry",""),
                    param.getOrDefault("sqrq",""),
                    param.getOrDefault("bxlcmc","0"),
                    param.getOrDefault("bxlcjlid",""),
                    param.getOrDefault("lcbh",""),
                    param.getOrDefault("bz","")
            );
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /**
     * 扣减冻结金额
     * @param lcjlid
     * @param bmzcjjfl
     * @param moneyDj
     * @param
     * @return
     */
    public  boolean modifyFreezeMoney(String lcjlid,String bmzcjjfl,BigDecimal moneyDj,BigDecimal cxje,Boolean flage){
        RecordSet rs=new RecordSet();
        String querySql="SELECT syed,dj FROM uf_jingfei  WHERE lcjlid="+lcjlid+" AND bmzcjjfl="+bmzcjjfl+" ";
        rs.executeQuery(querySql);
        boolean b=true;
        BigDecimal money=moneyDj.subtract(cxje);
        while (rs.next()) {
            BigDecimal syed=new BigDecimal(rs.getString("syed"));
            BigDecimal dj=new BigDecimal(rs.getString("dj"));
            syed=syed.add(money);
            String modifySql = "update uf_jingfei set dj=" + dj + ",syed=" + syed + " where lcjlid=" + lcjlid + " and bmzcjjfl=" + bmzcjjfl;
            LOGGER.info("modifySql---"+modifySql);
             b = rs.executeUpdate(modifySql);
        }
        return b;
    }

    public RecordSet getdjje(String reqid,String bmjjflid){
        RecordSet rs = new RecordSet();
        rs.executeQuery("select kmk.kmc,fei.dj,fei.syed,fei.ze from uf_jingfei fei,uf_jjzcflkmk kmk " +
                "where fei.requestId = " + reqid
                + " and fei.bmzcjjfl = kmk.kdm and fei.bmzcjjfl ="+bmjjflid);
        return rs;
    }

    /**
     * 修改经费明细表中状态值
     * @param lcbxjl
     * @param bxlcjlid 报销流程id
     * @param bxlcmc 报销流程明细
     * @return
     * 因为 bxlcjlid 取的是流程id，而不是报销的流程id，所以需要改，还有bxlcmc也需要改，暂时没取到值
     */
    public boolean modifyJingfeiSpzt(String lcbxjl,String bxlcjlid,String bxlcmc){
        RecordSetTrans rst=new RecordSetTrans();
        rst.setAutoCommit(false);
        //String updateSql="update uf_jingfei_dt1 set spzt=1,bxlcjlid=?,bxlcmc=? where bxlcjlid=?";
        String updateSql="update uf_jingfei_dt1 set spzt=1 where bxlcjlid=?";
        LOGGER.info("修改经费明细表中状态值>"+updateSql+" "+lcbxjl+"  "+bxlcjlid+"  "+bxlcmc);
        try {
            rst.executeUpdate(updateSql,bxlcjlid);
        } catch (Exception e) {
            e.printStackTrace();
            rst.rollback();
            return false;
        }
        rst.commit();
        return true;
    }

    /**
     * 添加报销流程明细记录
     * @param param
     * @return
     */
    public boolean addbxDetailRecord(Map<String,Object> param){
        LOGGER.info("添加报销流程明细记录");
        RecordSetTrans rts=new RecordSetTrans();
        rts.setAutoCommit(false);
        String sql="insert into uf_jingfei_dt2(mainid,bxje,bxlcid,xmlcid,xmlcmc,bmjjzcfl,zfjjzcfl,bz)" +
                "values("+"'"+param.get("mainid")+"'"+",'"+param.get("bxje")+"'"+",'"+param.get("bxlcid")+"'"+",'"+param.get("xmlcid")+"'"+",'"+param.get("xmlcmc")+"'"+",'"+param.get("bmjjzcfl")+"'"+",'"+param.get("zfjjzcfl")+"'"+",'"+param.get("bz")+"'"+")";
        try {
            LOGGER.info("sql-------:"+sql);
            rts.executeUpdate(sql);
//            rts.executeUpdate(sql,
//                    param.get("mainid"),
//                    param.get("bxje"),
//                    param.get("bxlcid"),
//                    param.get("xmlcid"),
//                    param.get("xmlcmc"),
//                    param.get("bmjjzcfl"),
//                    param.get("zfjjzcfl"),
//                    param.get("bz")
//                    );
        } catch (Exception e) {
            e.printStackTrace();
            rts.rollback();
            return false;
        }
        rts.commit();
        return true;
    }

    /**
     * 修改主表预算总金额
     * @param lcjlid
     * @param yszje
     * @return
     */
    public static boolean modifyYszje(String lcjlid,Double yszje){
        RecordSetTrans rst=new RecordSetTrans();
        String modify="UPDATE  uf_jingfei_version  SET yszje ="+yszje+" WHERE lcjlsqjlid = "+lcjlid+"";
        try {
            rst.executeUpdate(modify);
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
        return true;
    }

    public static void main(String[] args) {
        StringBuffer sb=new StringBuffer();
        String sql="SELECT count(1)AS num FROM uf_jingfei_version v,uf_wygljfbb wy,uf_wygljfbb_dt1\n" +
                "WHERE v.lcjlsqjlid=wy.requestId AND mainid=wy.id";
        sb.append(sql);
        sb.append(" AND lcztz<>3");
        System.out.println(sb);
        Double mouny=18031.02;
        System.out.println(mouny/10000);

    }
}
